﻿using UnityEngine;

namespace AAB.Scripts {
    public class FsmClearSignals : StateMachineBehaviour {
        public string[] clearAtEnter;
        public string[] cleatAtExit;
 
        // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            foreach (var signal in clearAtEnter)
            {
                animator.ResetTrigger(signal);//重置trigger
            }
        }
 
        // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
        //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
        //
        //}
 
        // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
        public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            foreach (var signal in clearAtEnter)
            {
                animator.ResetTrigger(signal);//重置trigger
            }
        }
    }
}